package com.cloudeasy.user.authorize;

import com.cloudeasy.core.authorize.AuthorizeConfigProvider;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.stereotype.Component;

/**
 * 用户授权配置提供者
 */
@Component
@Order(Integer.MIN_VALUE)
public class UserAuthorizeConfigProvier implements AuthorizeConfigProvider {
    @Override
    public void config(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config) {
        config.antMatchers(
                "/authCode/{email}",
                "/register",
                "/login",
                "/reset",

                "/can_do/{permissionId}/{operateUserId}",
                "/operate_area/{permissionId}/{operateUserId}",

                "/info/{userId}",
                "/info/list",
                "/info/list/{page}/{size}",

                "/attention/{userId}",
                "/attention/{userId}/{page}/{size}",
                "/fans/{userId}",
                "/fans/{userId}/{page}/{size}"
                ).permitAll();
    }
}
